<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>localStorage</title>
  <script src="https://cdn.bootcdn.net/ajax/libs/vConsole/3.4.1/vconsole.min.js"></script>
  <script>
    new VConsole();
  </script>
</head>
<body>
  <h1 id="local"></h1>
  <button @click="saveMessage()">保存到localStorage</button>

  <script>
    document.getElementById('local').innerHTML = localStorage.getItem('localStorage.html') || "no message";
    function saveMessage () {
      localStorage.setItem('localStorage.html', '你好呀');
    }
  </script>
</body>
</html>